package cn.sccdlg.lambda.demo01;

/**
 * @author RaoShuang
 * @emil 991207823@qq.com
 * @date 2020/6/4 22:48
 * 传统模式下线程创建与lambda函数式编程的对测试类
 */
public class DemoTesto1 {
    public static void main(String[] args) {
        //1、传统模式下，新线程的创建过程
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("Thread-->"+Thread.currentThread().getId());
                System.out.println("Thread-->"+Thread.currentThread().getName());
            }
        }).start();

        System.out.println("******************************");

        //2、lambda简化书写下的新线程的创建过程
        new Thread(()->{
            System.out.println("Thread-->"+Thread.currentThread().getId());
            System.out.println("Thread-->"+Thread.currentThread().getName());
        }).start();
    }
}
